import React from 'react'

export default class Count extends React.Component {
  constructor() {
    super()
    this.state = {
      //状态对象里面的属性就可以随便写
      count: 1,
    }
  }

  handle() {
    this.setState({
      count: this.state.count + 1,
    })
  }
  render() {
    return (
      <div>
        <p id="c">{this.state.count}</p>
        <button
          onClick={() => {
            // 对象调用
            this.handle()
          }}
        >
          +
        </button>
      </div>
    )
  }
}
